package com.corechina.apex_osswords.domain.dao;

import com.corechina.apex_osswords.domain.entity.SysUserToken;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Component;

/**
 * <p>
 * 用户token表 Mapper 接口
 * </p>
 *
 * @author cc
 * @since 2022-03-03
 */
@Component
public interface SysUserTokenMapper extends BaseMapper<SysUserToken> {

    @Select("select * from sys_user_token where user_id = #{userId} and login_type = #{loginType}")
    SysUserToken getByUserId(@Param("userId") Integer userId, @Param("loginType") Integer loginType);

    int updateUserTokenInfo(SysUserToken record);

    @Update("update sys_user_token set enterprise_id = #{enterpriseId} where user_id = #{userId}")
    int updateEnterpriseId(@Param("enterpriseId") Integer enterpriseId,@Param("userId") Integer userId);

}
